home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / language / osbind.arc / osbind.h next >
C/C++ Source or Header  |  1989-03-29  |  23KB  |  907 lines

  1. /*
  2.  * $Log:    osbind.h,v $
  3.  * Revision 1.2  89/03/08  22:18:03  bammi
  4.  * Many hacks etc. Version as distributed with gcc V1.34
  5.  * 
  6.  *
  7.  */
  8.  
  9. /*
  10.  *    OSBIND.H    Mnemonic names for operating system calls
  11.  *
  12.  * Adapted from Dale Schumacher's version to Mark Johnson C by Eric Gisin.
  13.  */
  14.  
  15. /* hacked by jrd for GNU */
  16.  
  17. /*
  18.  * more hacks
  19.  *    inline the traps
  20.  *
  21.  *        ++jrb bammi@dsrgsun.ces.cwru.edu
  22.  */
  23. #ifdef __STDC__
  24. #ifndef __NO_PROTO__
  25. static long trap_1_w(short);
  26. static long trap_1_ww(short, short);
  27. static long trap_1_wl(short, long);
  28. static long trap_1_wlw(short, long, short);
  29. static long trap_1_wwll(short, short, long, long);
  30. static long trap_1_wlww(short, long, short, short);
  31. static long trap_1_www(short, short, short);
  32. static long trap_1_wll(short, long, long);
  33. static long trap_1_wwlll(short, short, long, long, long);
  34. static long trap_13_wl(short, long);
  35. static long trap_13_w(short);
  36. static long trap_13_ww(short, short);
  37. static long trap_13_www(short, short, short);
  38. static long trap_13_wwlwww(short, short, long, short, short, short);
  39. static long trap_13_wwl(short, short, long);
  40. static long trap_14_wwll(short, short, long, long);
  41. static long trap_14_ww(short, short);
  42. static long trap_14_w(short);
  43. static long trap_14_wllw(short, long, long, short);
  44. static long trap_14_wl(short, long);
  45. static long trap_14_www(short, short, short);
  46. static long trap_14_wllwwwww(short, long, long, short, short, short, short, short);
  47. static long trap_14_wllwwwwlw(short, long, long, short, short, short, short, long, short);
  48. static long trap_14_wwwwwww(short, short, short, short, short, short, short);
  49. static long trap_14_wlll(short, long, long, long);
  50. static long trap_14_wllww(short, long, long, short, short);
  51. static long trap_14_wwwwl(short, short, short, short, long);
  52. #endif
  53. #endif
  54.  
  55. /*    
  56.  *    GEMDOS    (trap1)
  57.  */
  58. #define    Pterm0()                         \
  59.     (void)trap_1_w((short)(0x00))
  60. #define    Cconin()                         \
  61.     (long)trap_1_w((short)(0x01))
  62. #define    Cconout(c)                         \
  63.     (void)trap_1_ww((short)(0x02),(short)(c))
  64. #define    Cauxin()                         \
  65.     (short)trap_1_w((short)(0x03))
  66. #define    Cauxout(c)                         \
  67.     (void)trap_1_ww((short)(0x04),(short)(c))
  68. #define    Cprnout(c)                         \
  69.     (void)trap_1_ww((short)(0x05),(short)(c))
  70. #define    Crawio(data)                         \
  71.     (long)trap_1_ww((short)(0x06),(short)(data))
  72. #define    Crawcin()                         \
  73.     (long)trap_1_w((short)(0x07))
  74. #define    Cnecin()                         \
  75.     (long)trap_1_w((short)(0x08))
  76. #define    Cconws(s)                         \
  77.     (void)trap_1_wl((short)(0x09),(char *)(s))
  78. #define    Cconrs(buf)                         \
  79.     (void)trap_1_wl((short)(0x0A),(char *)(buf))
  80. #define    Cconis()                         \
  81.     (short)trap_1_w((short)(0x0B))
  82. #define    Dsetdrv(d)                         \
  83.     (long)trap_1_ww((short)(0x0E),(short)(d))
  84. #define    Cconos()                         \
  85.     (short)trap_1_w((short)(0x10))
  86. #define    Cprnos()                         \
  87.     (short)trap_1_w((short)(0x11))
  88. #define    Cauxis()                         \
  89.     (short)trap_1_w((short)(0x12))
  90. #define    Cauxos()                         \
  91.     (short)trap_1_w((short)(0x13))
  92. #define    Dgetdrv()                         \
  93.     (short)trap_1_w((short)(0x19))
  94. #define    Fsetdta(dta)                         \
  95.     (void)trap_1_wl((short)(0x1A),(void *)(dta))
  96. #define    Super(ptr)                         \
  97.     (long)trap_1_wl((short)(0x20),(void *)(ptr))
  98. #define    Tgetdate()                         \
  99.     (short)trap_1_w((short)(0x2A))
  100. #define    Tsetdate(date)                         \
  101.     (short)trap_1_ww((short)(0x2B),(short)(date))
  102. #define    Tgettime()                         \
  103.     (short)trap_1_w((short)(0x2C))
  104. #define    Tsettime(time)                         \
  105.     (short)trap_1_ww((short)(0x2D),(short)(time))
  106. #define    Fgetdta()                         \
  107.     (long)trap_1_w((short)(0x2F))
  108. #define    Sversion()                         \
  109.     (short)trap_1_w((short)(0x30))
  110. #define    Ptermres(save,rv)                     \
  111.     (void)trap_1_wlw((short)(0x31),(long)(save),(short)(rv))
  112. #define    Dfree(buf,d)                         \
  113.     (void)trap_1_wlw((short)(0x36),(void *)(buf),(short)(d))
  114. #define    Dcreate(path)                         \
  115.     (short)trap_1_wl((short)(0x39),(char *)(path))
  116. #define    Ddelete(path)                         \
  117.     (short)trap_1_wl((short)(0x3A),(char *)(path))
  118. #define    Dsetpath(path)                         \
  119.     (short)trap_1_wl((short)(0x3B),(char *)(path))
  120. #define    Fcreate(fn,mode)                     \
  121.     (short)trap_1_wlw((short)(0x3C),(char *)(fn),(short)(mode))
  122. #define    Fopen(fn,mode)                         \
  123.     (short)trap_1_wlw((short)(0x3D),(char *)(fn),(short)(mode))
  124. #define    Fclose(handle)                         \
  125.     (short)trap_1_ww((short)(0x3E),(short)(handle))
  126. #define    Fread(handle,cnt,buf)                     \
  127.     (long)trap_1_wwll((short)(0x3F),(short)(handle),    \
  128.               (long)(cnt),(char *)(buf))
  129. #define    Fwrite(handle,cnt,buf)                     \
  130.     (long)trap_1_wwll((short)(0x40),(short)(handle),     \
  131.               (long)(cnt),(char *)(buf))
  132. #define    Fdelete(fn)                         \
  133.     (short)trap_1_wl((short)(0x41),(char *)(fn))
  134. #define    Fseek(where,handle,how)                 \
  135.     (long)trap_1_wlww((short)(0x42),(long)(where),         \
  136.               (short)(handle),(short)(how))
  137. #define    Fattrib(fn,rwflag,attr)                 \
  138.     (short)trap_1_wlww((short)(0x43),(char *)(fn),         \
  139.                (short)(rwflag),(short)(attr))
  140. #define    Fdup(handle)                         \
  141.     (short)trap_1_ww((short)(0x45),(short)(handle))
  142. #define    Fforce(Hstd,Hnew)                     \
  143.     (short)trap_1_www((short)(0x46),(short)(Hstd),(short)(Hnew))
  144. #define    Dgetpath(buf,d)                     \
  145.     (void)trap_1_wlw((short)(0x47),(char *)(buf),(short)(d))
  146. #define    Malloc(size)                         \
  147.     (long)trap_1_wl((short)(0x48),(long)(size))
  148. #define    Mfree(ptr)                         \
  149.     (short)trap_1_wl((short)(0x49),(void *)(ptr))
  150. #define    Mshrink(ptr,size)                     \
  151.     (short)trap_1_wll((short)(0x4A),(short)0,(void *)(ptr),(long)(size))
  152. #define    Pexec(mode,prog,tail,env)                \
  153.     (short)trap_1_wwlll((short)(0x4B),(short)(mode),(char *)(prog),    \
  154.                 (char *)(tail),(char *)(env))
  155. #define    Pterm(rv)                         \
  156.     (void)trap_1_ww((short)(0x4C),(short)(rv))
  157. #define    Fsfirst(filespec,attr)                     \
  158.     (short)trap_1_wlw((short)(0x4E),(char *)(filespec),(short)(attr))
  159. #define    Fsnext()                         \
  160.     (short)trap_1_w((short)(0x4F))
  161. #define    Frename(zero,old,new)                     \
  162.     (short)trap_1_wwll((short)(0x56),(short)(zero),     \
  163.                (char *)(old),(char *)(new))
  164. #define    Fdatime(timeptr,handle,rwflag)                \
  165.     (void)trap_1_wlww((short)(0x57),(long)(timeptr),     \
  166.               (short)(handle),(short)(rwflag))
  167.  
  168.  
  169. /* codes for Pexec */
  170.  
  171. #define    PE_LOADGO        0        /* load & go */
  172. #define    PE_LOAD            1        /* just load */
  173. #define    PE_CBASEPAGE        2        /* just create basepage */
  174. #define    PE_GO            3        /* just go */
  175.  
  176.  
  177. /*
  178.  *    BIOS    (trap13)
  179.  */
  180. #define Getmpb(ptr)                        \
  181.         (void)trap_13_wl((short)(0x00),(void *)(ptr))
  182. #define    Bconstat(dev)                         \
  183.     (short)trap_13_ww((short)(0x01),(short)(dev))
  184. #define    Bconin(dev)                         \
  185.     (long)trap_13_ww((short)(0x02),(short)(dev))
  186. #define    Bconout(dev,c)                         \
  187.     (void)trap_13_www((short)(0x03),(short)(dev),(short)((c) & 0xFF))
  188. #define    Rwabs(rwflag,buf,n,sector,d)                \
  189.     (short)trap_13_wwlwww((short)(0x04),(short)(rwflag),(void *)(buf), \
  190.                   (short)(n),(short)(sector),(short)(d))
  191. #define    Setexc(vnum,vptr)                     \
  192.     (void (*)())trap_13_wwl((short)(0x05),(short)(vnum),(void (*)())(vptr))
  193. #define    Tickcal()                         \
  194.     (long)trap_13_w((short)(0x06))
  195. #define    Getbpb(d)                         \
  196.     (void *)trap_13_w((short)(0x07),(short)(d))
  197. #define    Bcostat(dev)                         \
  198.     (short)trap_13_ww((short)(0x08),(short)(dev))
  199. #define    Mediach(dev)                         \
  200.     (short)trap_13_ww((short)(0x09),(short)(dev))
  201. #define    Drvmap()                         \
  202.     (long)trap_13_w((short)(0x0A))
  203. #define    Getshift()                         \
  204.     (short)trap_13_w((short)(0x0B))
  205.  
  206. #if 0 /* huh ? */
  207. #define    Kbshift(data)                         \
  208.     trap_13_ww((short)(0x0B),(short)(data))
  209. #endif
  210.  
  211.  
  212. /*
  213.  *    XBIOS    (trap14)
  214.  */
  215.  
  216. #define    Initmous(type,param,vptr)                \
  217.     (void)trap_14_wwll((short)(0x00),(short)(type),         \
  218.                (void *)(param),(void *)(vptr))
  219. #define Ssbrk(size)                        \
  220.         (void *)trap_14_ww((short)(0x01),(short)(size))
  221. #define    Physbase()                         \
  222.     (void *)trap_14_w((short)(0x02))
  223. #define    Logbase()                         \
  224.     (void *)trap_14_w((short)(0x03))
  225. #define    Getrez()                         \
  226.     (short)trap_14_w((short)(0x04))
  227. #define    Setscreen(lscrn,pscrn,rez)                \
  228.     (void)trap_14_wllw((short)(0x05),(void *)(lscrn),(void *)(pscrn), \
  229.                (short)(rez))
  230. #define    Setpallete(palptr)                     \
  231.     (void)trap_14_wl((short)(0x06),(void *)(palptr))
  232. #define    Setcolor(colornum,mixture)                \
  233.     (short)trap_14_www((short)(0x07),(short)(colornum),(short)(mixture))
  234. #define    Floprd(buf,x,d,sect,trk,side,n)                \
  235.     (short)trap_14_wllwwwww((short)(0x08),(void *)(buf),(long)(x), \
  236.       (short)(d),(short)(sect),(short)(trk),(short)(side),(short)(n))
  237. #define    Flopwr(buf,x,d,sect,trk,side,n)                \
  238.     (short)trap_14_wllwwwww((short)(0x09),(void *)(buf),(long)(x)